<?php

declare(strict_types=1);

namespace App\Model\Users;



use App\Model\Model;

/**
 * @property int $id 
 * @property int $uid 绑定账号uid
 * @property int $type 类型1 ：微信小程序
 * @property string $openid 微信小程序openid
 * @property string $unionid 微信唯一unicode
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 */
class UsersMiniAuth extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'users_mini_auth';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'type', 'openid', 'unionid', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'type' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];


    /**
     * 用户信息
     * @return \Hyperf\Database\Model\Relations\HasOne
     */
    public function user()
    {
        return $this->hasOne(User::class,'id','uid');
    }
}
